{% extends "GitonomyWebsiteBundle::layout.html.twig" %}

{% trans_default_domain 'project_list' %}
{% set global_navigation = 'projects' %}

{% block title 'page.title'|trans %}

{% block content %}
    <h1>
        {{ 'title'|trans }}
    </h1>

    <div id="content">
        {% if is_granted('ROLE_PROJECT_CREATE') %}
            <div class="actionbar">
                <div class="pull-right">
                    <a href="{{ path('project_create') }}" class="menu"><i class="symbol">add</i> {{ 'contextual.new_project'|trans }}</a>
                </div>
            </div>
        {% endif %}

        <table class="table">
            <thead>
                <tr>
                    <th>{{ 'table.column.name'|trans }}</th>
                    <th>{{ 'table.column.access'|trans }}</th>
                    <th>{{ 'table.column.size'|trans }}</th>
                    <th>{{ 'table.column.branches'|trans }}</th>
                    <th>{{ 'table.column.tags'|trans }}</th>
                    <th>&nbsp;</th>
                </tr>
            </thead>
            <tbody>
                {% for project in projects %}
                    <tr>
                        <td><a href="{{ path('project_newsfeed', {slug: project.slug}) }}">{{ project.name }}</a></td>
                        <td><code>git clone {{ config.get('ssh_access')~':'~project.slug~'.git' }}</code></td>
                        <td>{{ '%.2f'|format(project.repositorySize/1024) }} Mo</td>
                        <td>{{ project.repository.references.branches|length }}</td>
                        <td>{{ project.repository.references.tags|length }}</td>
                    </tr>
                {% else %}
                    <tr>
                        <td colspan="4">{{ 'table.no_row_found'|trans }}</td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
{% endblock %}
